import React, { Component } from "react";
import { CartConsumer } from "./Cart.jsx";

class Child2 extends Component {
  render() {
    return (
      <CartConsumer>
        {(value) => {
          return (
            <>
              <button onClick={value.decrement}>-</button>
              <span>{value.count}</span>
              <button onClick={value.increment}>+</button>
            </>
          );
        }}
      </CartConsumer>
    );
  }
}

export default Child2;
